﻿@model ArivisAccounts.Models.EditRoleModel

@{
    ViewBag.Title = "Edit Role";
}

@using (Html.BeginForm("Edit", "Role"))
{
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Edit Users in Role</legend>
        @Html.HiddenFor(model => model.Role)
        <table class="editor-table">
            <tr>
                <td class="editor-label">
                    @Html.LabelFor(model => model.Role)
                </td>
                <td class="editor-field">
                    @Html.DisplayFor(model => model.Role)
                </td>
            </tr>
            <tr>
                <td class="editor-label">
                    @Html.LabelFor(model => model.UsersInRole)
                </td>
                <td class="editor-field">
                    @foreach (string user in Model.AllUsers)
                    {
                        <label>
                            @if (Model.UsersInRole.Contains(user))
                            {
                                <input type="checkbox" name="UsersInRole" value="@user" checked="checked" />
                            }
                            else
                            {
                                <input type="checkbox" name="UsersInRole" value="@user" />
                            }
                            @Html.Encode(user)
                        </label>
                    }
                </td>
            </tr>
        </table>
        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
